/**
  ******************************************************************************
  * @file   :   .c
  * @version:    
  * @author :
  * @brief  :
  ******************************************************************************
  * @attention
  *
  * <h2><center>&copy; Copyright(c) . BLUEX Microelectronics.
  * All rights reserved.</center></h2>
  *
  *
  ******************************************************************************  
  */ 

/* includes ------------------------------------------------------------------*/


#include <stdio.h>
#include "apollo_00_reg.h"
#include "uart_api.h"

/* private define ------------------------------------------------------------*/

/* private typedef -----------------------------------------------------------*/

/* private variables ---------------------------------------------------------*/

/*============================= private function =============================*/
/** ---------------------------------------------------------------------------
 * @brief   :
 * @note    :
 * @param   :
 * @retval  :
-----------------------------------------------------------------------------*/
static void prv_user_delay( uint32_t val )
{
    for( uint32_t i = 0; i < val; i++ )
        for( uint32_t j = 0; j < 5000; j++ );
}
/*========================= end of private function ==========================*/


/*============================= exported function ============================*/

/** ---------------------------------------------------------------------------
 * @brief   :   
 * @note    :   
 * @param   :	
 * @param   :	
 * @retval  :
-----------------------------------------------------------------------------*/
void printf_test(void)
{
    uart_init();
    int i=0;
    float j=0;
    while(1) {
        i++;
        j+=0.5;
        printf("123,%u,%f\r\n",i,j);
        prv_user_delay(1000);
    }
}
/*========================= end of exported function =========================*/


/*============================= import function ==============================*/

/** ---------------------------------------------------------------------------
 * @brief   :   uart_redirect
 * @note    :
 * @param   :
 * @retval  :
-----------------------------------------------------------------------------*/
int fputc( int ch, FILE * f )
{
    BX_UART0->RTD = ch;
    while( BX_READ_BIT( BX_UART0->LS, UART_LS_TX_EMPTY ) == 0 );
    return ch;
}

/** ---------------------------------------------------------------------------
 * @brief   :   uart_redirect
 * @note    :
 * @param   :
 * @retval  :
-----------------------------------------------------------------------------*/
int fgetc( FILE * f )
{
    while( BX_READ_BIT( BX_UART0->LS, UART_LS_DATA_READY ) == 0 );
    return BX_UART0->RTD;
}
/*=========================== end of import function =========================*/


/*============================ interrupt function ============================*/



/*========================= end of interrupt function ========================*/


/******************** (C) COPYRIGHT BLUEX **********************END OF FILE****/
